<?php
/**
 * Entry Model of the database
 * @author: Ueli Kramer <ueli.kramer@gmail.com>
 */

class Entry extends Eloquent
{

    public static $table = 'wiki_entry';
    public static $timestamps = true;

    public function language()
    {
        return $this->belongs_to('Language');
    }

    public function user()
    {
        return $this->belongs_to('User');
    }

    public function categories()
    {
        return $this->has_many_and_belongs_to('Category', 'wiki_category_has_wiki_entry');
    }

    public function files()
    {
        return $this->has_many_and_belongs_to('File', 'wiki_entry_has_file');
    }

    public function tags()
    {
        return $this->has_many_and_belongs_to('Tag', 'wiki_entry_has_wiki_tag');
    }

}